# Importing Data
TURKEY<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "AG1:AG229")

# Checking the Imported Data
View(TURKEY)
# Creating Time Series Data
TURKEY_ts <- ts(TURKEY, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
TURKEY_ts
sum(is.na(TURKEY_ts))
library(forecast)
TURKEY_ts <- tsclean(TURKEY_ts)
TURKEY_ts

# Identification: Plotting the Time Series Data
plot(TURKEY_ts)

# Estimating the appropriate model
TURKEY_ts_model <- auto.arima(TURKEY_ts)
TURKEY_ts_model

# Forecasting
options(max.print=1000000)
TURKEY_ts_forecast <- forecast (TURKEY_ts_model, level=c(95), h=288)
plot(TURKEY_ts_forecast)
TURKEY_ts_forecast             

# Exporting
write.table(TURKEY_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/TURKEY_TSA.csv", sep=",")
